#ifndef SPA_QUERY_VALIDATOR_H
#define SPA_QUERY_VALIDATOR_H

#include <map>
#include <list>
#include <vector>
#include <string>
#include <functional>

#include "QueryTypes.h"


class QueryValidator
{
	private:

		struct RelationPrototype
		{
			std::vector<std::vector<EntityType>> parameters;
		};
		std::map<RelationType, RelationPrototype> _table;

		std::list<std::string> _errors;
		std::map<std::string, EntityType> _entities;

		bool ResolveOverload( query_relation& relation );
		bool ValidatePrototype( query_relation& relation );
		bool ValidateParameter( query_parameter& parameter );

	public:
		QueryValidator();
		~QueryValidator();

		bool Validate( query_tree& tree );
		std::list<std::string> GetErrors();
};

#endif